import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class Main implements CommandLineRunner {

    @Autowired
    private RestTemplateSelector restTemplateSelector;

    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        String url1 = "https://example1.com/api";
        String url2 = "https://example2.com/api";

        RestTemplate restTemplate1 = restTemplateSelector.getRestTemplate(url1);
        RestTemplate restTemplate2 = restTemplateSelector.getRestTemplate(url2);

        String response1 = restTemplate1.getForObject(url1, String.class);
        String response2 = restTemplate2.getForObject(url2, String.class);

        System.out.println("Response from API 1: " + response1);
        System.out.println("Response from API 2: " + response2);
    }
}    